/**
 * PLEASE NOTE: In order to properly run this test, comment out 
 * the showRandomEvenMsg method in randomIllPlayer's IF and ELSE statement.
 * This disables pop=up boxes in the view
 */

package edu.gatech.cs2340.bytebankers.tests;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import edu.gatech.cs2340.bytebankers.model.Journey;
import edu.gatech.cs2340.bytebankers.model.Player;
import edu.gatech.cs2340.bytebankers.presenter.JourneyPresenter;
import edu.gatech.cs2340.bytebankers.view.JourneyView;

/**
 * This JUnit tests the efficiency of the randomIllPlayer() method
 * in the JourneyPresenter
 * @author Kellie
 *
 */
public class RandomIllPlayerTest {
	Player currPlayer;
	
	@Test
	public void testRandomIllPlayer() {
		int count = 0;
		Journey journey = new Journey();
		JourneyPresenter presenter = new JourneyPresenter(journey);
		Player bob = new Player(); bob.setsickStatus("good"); bob.setName("bob"); journey.addPlayer(bob);
		Player guy = new Player(); guy.setsickStatus("good"); guy.setName("guy"); journey.addPlayer(guy);
		Player sandy = new Player(); sandy.setsickStatus("good"); sandy.setName("sandy"); journey.addPlayer(sandy);
		Player sue = new Player(); sue.setsickStatus("good"); sue.setName("sue"); journey.addPlayer(sue);
		Player chris = new Player(); chris.setsickStatus("good"); chris.setName("chris"); journey.addPlayer(chris);
		for (Player player: journey.getPlayers()){
			assertTrue("Players not all 'good'", player.getSickStatus().compareTo("good") == 0);
		}
		presenter.randomIllPlayer();
		for (Player player: journey.getPlayers()){
			if (player.getSickStatus().compareTo("ill") == 0){
				count++;
				currPlayer = player;
			}
		}
		assertEquals("All players are 'good'", 1, count);
		assertTrue("Players not 'ill'", currPlayer.getSickStatus().compareTo("ill") == 0);
		assertEquals("Ill player not stored",presenter.getIllList().size(), 1);
		for(int i = 0; i < 6; i++){
			presenter.randomIllPlayer();
		}
		assertTrue("Player has not died", journey.getPlayers().size() < 5);
		
	}

}
